home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3322 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.4 KB  |  43 lines

  1. Path: populus.slu.se!newsmgr
  2. From: Thomas.Johansson@stax.slu.se (Thomas Johansson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: [Q]Assigning function pointer in C/C++.
  5. Date: 23 Jan 1996 11:41:55 GMT
  6. Organization: SLU Umeσ
  7. Message-ID: <4e2hi3$pbd@populus.slu.se>
  8. References: <DL3JJu.5nB.0.queen@torfree.net> <4doc42$gsb@bmdhh222.bnr.ca> <ALUN.CHAMPION.96Jan19113523@g7240065.bridge.bst.bls.com> <4e09re$kit@populus.sl <4e0o5l$fjc@colossus.holonet.net>
  9. NNTP-Posting-Host: b93.resgeom.slu.se
  10. X-Newsreader: WinVN 0.92.1
  11.  
  12. In article <4e0o5l$fjc@colossus.holonet.net>, russell@news.mdli.com (Russell Blackadar) says:
  13. >BTW, you don't *have* to use a typedef.
  14. >
  15. >:   Fp f = (a.*p);       // the object a (of class A) has a member p
  16. >
  17. >Should be
  18. >    Fp f = &A::p;   // where  int p(void) is a member-function of A
  19. >
  20. >:   int z = f();
  21. >
  22. >Should be
  23. >    int z = (a.*f)();   // note parens, .* has low precedence
  24. >
  25. >The operators .* and ->* are used to call the function, not to
  26. >initialize the pointer.
  27. >
  28.  
  29. Thats just the point I would like to make : I would like to store the
  30. 'final' pointer value, not the offset into the class that f represents.
  31. I would like to bind the object an the offset, then store the pointer
  32. to use at a later stage (a callback function). I do not have access to
  33. the original object when it comes to calling f. This is propably 
  34. impossible in C++, I just wanted confirmation on that so that I can
  35. seek other methods.
  36.  
  37.  
  38.  
  39.  
  40. Regards
  41.  
  42. Thomas J
  43.